import lib.problem as problem

class Problem004(problem.Problem):
	def __init__(self):
		problem.Problem.__init__(self, 4)
		
	def solve(self):
		largest = 0
		
		for i in range(100, 1000):
			for j in range(100, 1000):
				m = i * j
				s = str(m)
				
				palindrome = True
				for pos in range(len(s) / 2):
					if not (s[pos] == s[len(s) - 1 - pos]):
						palindrome = False
						
				if palindrome and m > largest:
					largest = m
		
		return largest


if __name__ == "__main__":
	print(Problem004().solveAndTime())